Skip to content

Port upstream PRs #554, #555, #544: require permission handler, add custom-tool kind, task_complete event#32

Merged
krukow merged 1 commit into
mainfrom
upstream-sync/require-permission-handler-v0.1.26
Feb 26, 2026
Merged

Port upstream PRs #554, #555, #544: require permission handler, add custom-tool kind, task_complete event#32
krukow merged 1 commit into
mainfrom
upstream-sync/require-permission-handler-v0.1.26

Conversation

@krukow
Copy link
Copy Markdown
Collaborator

@krukow krukow commented Feb 26, 2026

Summary

BREAKING: :on-permission-request is now required in session config maps for create-session and resume-session (and their async variants).

This PR ports three upstream copilot-sdk changes:

PR #554 — Require onPermissionRequest on session creation/resume

  • :on-permission-request moved from opt-un to req-un in ::session-config and ::resume-session-config specs
  • Removed 0-arity create-session and 2-arity resume-session (and async variants)
  • Added explicit validation with clear error message before spec validation
  • Updated with-session macro to require config argument
  • Updated all tests (integration + E2E), examples (10 files), and docs

PR #555 — Add custom-tool permission kind

  • Added :custom-tool to ::permission-kind spec for custom tool permission requests

PR #544 — Agent selection & compaction (partial)

  • Added :copilot/session.task_complete event type (additive)
  • Skipped RPC methods (agent.select, context.compact) — not exposed in public SDK API

Bug fix (found during code review)

  • Fixed build-session-config in helpers.clj to pass through :on-permission-request — without this, h/query, h/query-seq!, and h/query-chan would silently drop the handler when creating sessions from option maps

Verification

  • ✅ 85 tests, 253 assertions, 0 failures
  • ✅ All 9 examples pass
  • ✅ Documentation valid (10 files, 0 warnings)

Files changed (23)

  • Specs/Client: specs.clj, client.clj, copilot_sdk.clj, helpers.clj, instrument.clj
  • Tests: integration_test.clj, e2e_test.clj, copilot_sdk_test.clj
  • Examples: 10 example files
  • Docs: README.md, getting-started.md, API.md, examples/README.md, CHANGELOG.md

…ustom-tool kind, task_complete event

**BREAKING**: `:on-permission-request` is now required in session config.

Upstream changes ported:
- PR #554: Make `onPermissionRequest` required on session creation/resume.
  Removes 0-arity `create-session` and 2-arity `resume-session` (and their
  async variants). Adds explicit validation with clear error message.
- PR #555: Add `:custom-tool` to `::permission-kind` spec for custom tool
  permission requests.
- PR #544: Add `:copilot/session.task_complete` event type (additive only;
  agent/compaction RPC methods not ported as they are not in public SDK API).

Also fixes `build-session-config` in helpers.clj to pass through
`:on-permission-request` (caught during code review).

All tests (85 tests, 253 assertions), examples (9/9), and docs validated.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings February 26, 2026 01:48
@krukow krukow merged commit 8a58b08 into main Feb 26, 2026
3 checks passed
@krukow krukow deleted the upstream-sync/require-permission-handler-v0.1.26 branch February 26, 2026 01:51
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR ports three upstream Node.js SDK changes to the Clojure SDK, implementing a breaking change that requires permission handlers for all session operations. The primary change makes :on-permission-request a required parameter when creating or resuming sessions, aligning with the upstream SDK's API contract. Additionally, it adds support for custom-tool permissions and the task_complete event type.

Changes:

  • BREAKING: :on-permission-request is now required in all session creation/resumption calls, enforced by specs and explicit validation
  • Added :custom-tool permission kind for SDK-registered custom tool invocations (upstream PR #555)
  • Added :copilot/session.task_complete event type (upstream PR #544)
  • Fixed critical bug in helpers.clj where build-session-config was dropping the :on-permission-request handler

Reviewed changes

Copilot reviewed 23 out of 23 changed files in this pull request and generated no comments.

Show a summary per file
File Description
src/github/copilot_sdk/specs.clj Moved :on-permission-request from opt-un to req-un in session config specs; added :custom-tool to permission-kind; added :copilot/session.task_complete event type
src/github/copilot_sdk/client.clj Added explicit validation for required permission handler with helpful error messages; removed 0-arity create-session and 2-arity resume-session variants; updated all docstrings to mark handler as required
src/github/copilot_sdk.clj Removed optional arity overloads from wrapper functions; updated with-session macro to require config parameter; comprehensive docstring updates
src/github/copilot_sdk/helpers.clj Fixed build-session-config to pass through :on-permission-request (critical for query helpers); updated docstring examples
src/github/copilot_sdk/instrument.clj Updated fdef specs to require config parameter (removed s/? optional markers)
test/github/copilot_sdk_test.clj Updated spec validation tests to include required :on-permission-request handler
test/github/copilot_sdk/integration_test.clj Updated all 50+ test cases; added comprehensive validation tests for missing handlers; added :custom-tool to permission kind tests
test/github/copilot_sdk/e2e_test.clj Updated all E2E tests with required permission handlers
examples/*.clj Updated all 10 example files to include :on-permission-request copilot/approve-all
examples/README.md Updated all code snippets with permission handlers; revised permission model description
doc/getting-started.md Updated all examples and tutorial code with required handlers
doc/reference/API.md Comprehensive updates to API documentation marking handler as required; updated all code examples
README.md Updated quick start examples with permission handlers
CHANGELOG.md Well-structured changelog entry following Keep a Changelog conventions; clearly marked as BREAKING

github-actions Bot pushed a commit that referenced this pull request Feb 26, 2026
…reference

- Add :copilot/session.task_complete to Event Reference table in API.md
- Add permission kind reference table listing all kinds (:shell, :write,
  :mcp, :read, :url, :custom-tool) in Permission Handling section
- Update CHANGELOG.md [Unreleased] section

Both were added in PR #32 (upstream PRs #544, #555) but were missing
from the API reference documentation.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants